package com.gx.server.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gx.server.common.BaseResponse;
import com.gx.server.common.ResultUtils;
import com.gx.server.model.domain.User;
import com.gx.server.model.domain.Video;
import com.gx.server.model.service.UserService;
import com.gx.server.model.service.VideoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Dobby
 * @version 1.0
 */


@RestController
@RequestMapping("/Video")
@Slf4j
public class VideoController {

    @Autowired
    private VideoService videoService;

    /**
     * 根据科目类型返回所有的视频
     * @return
     */
    @GetMapping("/subject/{subject}")
    public BaseResponse<List<Video>> Video_subject(@PathVariable int subject){
        LambdaQueryWrapper<Video> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Video::getSubject,subject);
        //查表
        List<Video> list = videoService.list(queryWrapper);
        return ResultUtils.success(list);
    }



}
